package com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel

import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.CourseListsBean

class TeachingTimeViewModel:BaseViewModel() {
    private val loginRepository by lazy { RetrofitClient.getApiService() }
    val myCodeState = MutableLiveData<Boolean>()
    val courseListsState = MutableLiveData<CourseListsBean>()
    /**
     * 获取自定义设置授课时间
     */
    fun courseLists(){
        launch(
            block = {
                val codeStatus = loginRepository.courseLists()
                courseListsState.value=codeStatus.result()
                myCodeState.value=codeStatus.success()
            },
            error = {
                myCodeState.value = false
            },
            cancel = {

            },
            showErrorToast = false
        )
    }

}